UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M5fLiUatZm8xUVhYcaE7NKqrug78kQqn5CjFTlWl8tQ=' 
WHERE 
  key_id = 'b8617fea50dc66d4e13386e13b5eef21516b4781e0712649206ecb229a9843ae' 
  AND (
    token = 'M5fLiUatZm8xUVhYcaE7NKqrug78kQqn5CjFTlWl8tQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021