UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8yW7NrAvnVj/61Sfnugaa+LnU3xGuo9vwAihUL2+1ec=' 
WHERE 
  key_id = '9e21037882f53240173b9a325ddece36342d7354939ca16476076d29071e4465' 
  AND (
    token = '8yW7NrAvnVj/61Sfnugaa+LnU3xGuo9vwAihUL2+1ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038