UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ly0Uqm/7LCNkXB5SNTTHkwo5u6qBvZK5ewZswPgAxtI=' 
WHERE 
  key_id = 'f4255d685d450b0dea4bef86db58e04aeb28e361c3bcc540234aa4fd91b18112' 
  AND (
    token = 'ly0Uqm/7LCNkXB5SNTTHkwo5u6qBvZK5ewZswPgAxtI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035