UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ba9MIAWHa3d1/NEYwkInsNJd9Qj9TyBCmHD8/b0NZZw=' 
WHERE 
  key_id = 'c21147714705a5d15a3197077cfdcfde960eb29052256f46c41c59ae92350079' 
  AND (
    token = 'Ba9MIAWHa3d1/NEYwkInsNJd9Qj9TyBCmHD8/b0NZZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034