UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9XuiyBg2e4egKnH4SLEafQO5rdPRFs1k06EasCVfYkI=' 
WHERE 
  key_id = 'bb5ee50320d7627fc0fa0173c1ae10bc0d9166e02a1d75ef1513100a8b6ef509' 
  AND (
    token = '9XuiyBg2e4egKnH4SLEafQO5rdPRFs1k06EasCVfYkI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056