UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FOsanhj5/JVaLyNwSxriKPO1BgKFlII3/AtcshAr0+8=' 
WHERE 
  key_id = '0dfa6c3376aa6b8328dcaa5b3a6eb74f8c25c71ee4fd4d1013f02c39e704a0ec' 
  AND (
    token = 'FOsanhj5/JVaLyNwSxriKPO1BgKFlII3/AtcshAr0+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031