UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'emVgp/zNs6dHrHSPLi09lON2J8HNXAanEQOfXyqsoWQ=' 
WHERE 
  key_id = '6cb4442cb97745305e9f7a1d30ffd501271a6405b5f108f9d58b971e07d4089d' 
  AND (
    token = 'emVgp/zNs6dHrHSPLi09lON2J8HNXAanEQOfXyqsoWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038