UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GKaO231R42C7cx5FOz2lenkvsAfjGA4YxUntJu1KgPw=' 
WHERE 
  key_id = '808a8eda0e8d85a70b67eeb30b548486830512b8bd269c165569f84bcaa88b70' 
  AND (
    token = 'GKaO231R42C7cx5FOz2lenkvsAfjGA4YxUntJu1KgPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032