UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NWutIwZFtI4iPze196AjVHXMf6ucGgruY514xw8Fl9w=' 
WHERE 
  key_id = '3f53ab3e56f9832d7111d9150f950a80c1de150af860f1b069e551de2ba28c61' 
  AND (
    token = 'NWutIwZFtI4iPze196AjVHXMf6ucGgruY514xw8Fl9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016