UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jgw15qe5jhs7vswFG2Oex2yHc1YEcONV77SdH0gK+5I=' 
WHERE 
  key_id = '027b6670b4651c441bcb354db0d4409909218e8e137eb732bf0dace94fbc6ac6' 
  AND (
    token = 'jgw15qe5jhs7vswFG2Oex2yHc1YEcONV77SdH0gK+5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026