UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LSfNPca6KuxFr4fa4s2nErZkuOqS1N12dH6s3ORYj3Q=' 
WHERE 
  key_id = '7854a9848d7d88176f9fa928049b30291b028a44ab5fa1168bbe9287a68843b5' 
  AND (
    token = 'LSfNPca6KuxFr4fa4s2nErZkuOqS1N12dH6s3ORYj3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029