UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZPAVmlI2Is6XLNd3JQ7wFAcdq0CKLa8wzVISJWCzUbw=' 
WHERE 
  key_id = '4c9eb8d98e07f340d6eef2b932376199cbb4f542862852a3d2a1e3bd6c05e8ff' 
  AND (
    token = 'ZPAVmlI2Is6XLNd3JQ7wFAcdq0CKLa8wzVISJWCzUbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040