UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E4jPd34eCMbGCDvK2H6TP2632E1awdb4VV/9Ri45wrU=' 
WHERE 
  key_id = '097803a55a5f44ec28931aa37c62afcabb9ecc364aff429ee75569f21be10ccd' 
  AND (
    token = 'E4jPd34eCMbGCDvK2H6TP2632E1awdb4VV/9Ri45wrU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025