UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1Pp+2aEdRWgkDFRDFIJr6UUn5LkK2wz8so/hsayc7Y=' 
WHERE 
  key_id = '9422f1148b762c21965e143c3eb466f940830e5b7cdf82cf1fa8166aa6d6df0c' 
  AND (
    token = 'y1Pp+2aEdRWgkDFRDFIJr6UUn5LkK2wz8so/hsayc7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019