UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CqTRhmpaoj4faHSSPiAunbg7TJ9uEF6K7c8W2Cm/75k=' 
WHERE 
  key_id = '2da9a6c82cbd66550b3110871e45264a9bca62150adcc634def5422d703c6c3d' 
  AND (
    token = 'CqTRhmpaoj4faHSSPiAunbg7TJ9uEF6K7c8W2Cm/75k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030