UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BnYr5zz9IG/ttIxbqx06xD5m0n8qTOhr5GmzYWwcxuk=' 
WHERE 
  key_id = 'ba8335286be1e556993b70ee4777531807aef9c6f822a50e804608c0809db65a' 
  AND (
    token = 'BnYr5zz9IG/ttIxbqx06xD5m0n8qTOhr5GmzYWwcxuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022