UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rXwWN+dk6kqol/yUhN+MtVCLap9KwcvE37ofw7rSfjc=' 
WHERE 
  key_id = 'dce8a98e6223546f9cec518e8f84917de6367f246c48a01a4fddd1c584def1ff' 
  AND (
    token = 'rXwWN+dk6kqol/yUhN+MtVCLap9KwcvE37ofw7rSfjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021