UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xxMMqgogo5PUwQcxAwZBBoQD/O76JAfINoT5HhAff3k=' 
WHERE 
  key_id = 'c3405615841c3e1dda63dcfa629c44ea6d8679897025712ec3430ce898543638' 
  AND (
    token = 'xxMMqgogo5PUwQcxAwZBBoQD/O76JAfINoT5HhAff3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028