UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e3ZW88Yk5TwSrfj2/B4DBHlmSCVTQqzs+2sO+WkCNNc=' 
WHERE 
  key_id = 'e9b889ad651921de757b035226fbc148ee7620967dd83b4c908774722afd9a1b' 
  AND (
    token = 'e3ZW88Yk5TwSrfj2/B4DBHlmSCVTQqzs+2sO+WkCNNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031