UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VltkhLBTInxqQw9P0vWrP/0ouVuMGAX4r6l1TrtHWfc=' 
WHERE 
  key_id = '2195201dc11e1d3a4b0d1719a2195605670d7c4b66db02fbc36689854089fbca' 
  AND (
    token = 'VltkhLBTInxqQw9P0vWrP/0ouVuMGAX4r6l1TrtHWfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026