UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gFHcFhubBxYJmR4aRkZbKjQxSQKfUtcMl086kI8jr1w=' 
WHERE 
  key_id = '1278da404d01be06ecd7a040b0a68d2d2f2d328859e5851ad943f468e61df3c9' 
  AND (
    token = 'gFHcFhubBxYJmR4aRkZbKjQxSQKfUtcMl086kI8jr1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024