UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't9Fw8pBbF2cg3X78Tgpj04wUDdw8u02il4IKXztqCkk=' 
WHERE 
  key_id = '6af3e18e6ef49e1a830224d0b3894cf0153ae8707c800ba4f9b6b4f0d1a99c02' 
  AND (
    token = 't9Fw8pBbF2cg3X78Tgpj04wUDdw8u02il4IKXztqCkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034