UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tgH7bfH3aw47A5tyYaLUOB/8bh7ibPS6RWDV2oypw1s=' 
WHERE 
  key_id = '61ba1ae76369b5d18eef2c24bc9087c5472383191a5357e5664e5372da52c2a2' 
  AND (
    token = 'tgH7bfH3aw47A5tyYaLUOB/8bh7ibPS6RWDV2oypw1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034