UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WwUhlrbLok+QzS0Wmr7Eh1yGiDYpAdRNoKLX86Kk0eM=' 
WHERE 
  key_id = '4a688a02cbc44d5af364a67ae4a304944282a35104ebae66fd174698d84319b3' 
  AND (
    token = 'WwUhlrbLok+QzS0Wmr7Eh1yGiDYpAdRNoKLX86Kk0eM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030