UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hmNJTnX9ZGtBknDhJ7mpcqYl+ua4ibRliBZTvTWjZDQ=' 
WHERE 
  key_id = '6aadc6549dda52488ce959c57c18e35df3c18077ca9c40e64708e024eddc3740' 
  AND (
    token = 'hmNJTnX9ZGtBknDhJ7mpcqYl+ua4ibRliBZTvTWjZDQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047