UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fx7q01Jjw/bCs9A97z4N3zSCHVQ5i779g5BEPog845M=' 
WHERE 
  key_id = 'ede6ca1592f3fcd378bfd82ff5757fd74b62344e28e29ea5d7d98a2be31f60be' 
  AND (
    token = 'fx7q01Jjw/bCs9A97z4N3zSCHVQ5i779g5BEPog845M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031