UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AChtbZzpHHsr8/bNUhF11a1dPeTCel6MVwYUksr7vP8=' 
WHERE 
  key_id = '9747ec523271a6d7033feaebce3b286e893d835a42562010078007ec23688f25' 
  AND (
    token = 'AChtbZzpHHsr8/bNUhF11a1dPeTCel6MVwYUksr7vP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023